import { Component, OnInit } from '@angular/core';

declare var form: any;

@Component({
    templateUrl: './cloud.index.data.component.html'
})
export class CloudIndexDataComponent implements OnInit {

    public fs: any = null;
    public columnTypeDic: any = null;

    constructor() {
        //注册表单
        this.fs = new form.FormSideTreeService('cloudindexdata', {
            orderObject: { order: 0 },
            keyField: 'id',
            randomFields: ['id'],
            pageSize: 1000,
            foreignKey: 'indexid'
        });

        // 初始化字典
        this.columnTypeDic = new form.DictionaryService('f_cloud_column',this.filter);
        this.columnTypeDic.load('0');
    }

    filter(data) {
        if (data) {
            const ri = [];
            for (let i = data.length - 1; i >= 0; i--) {
                const e = data[i];
                if (e.info && e.info === '3') {
                    ri.push(i);
                }
            }
            ri.forEach((j) => {
                data.splice(j, 1);
            });
        }
        return data;
    }

    ngOnInit(): void {
    }
}
